FROM {{ namespace }}/{{ image_prefix }}monasca-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}

{% block monasca_api_header %}{% endblock %}

{% import "macros.j2" as macros with context %}

{% if install_type == 'binary' %}

RUN echo '{{ install_type }} not yet available for {{ base_distro }}' \
    && /bin/false

{% elif install_type == 'source' %}

    {% if base_package_type == 'rpm' %}
        {% set monasca_api_packages = [
            'mariadb',
        ] %}
    {% elif base_package_type == 'deb' %}
        {% set monasca_api_packages = [
            'mariadb-client',
        ] %}
    {% endif %}
{{ macros.install_packages(monasca_api_packages | customizable("packages")) }}

ADD monasca-api-archive /monasca-api-source

{% set monasca_api_pip_packages = [
    'influxdb',
    '/monasca-api'
] %}

RUN ln -s monasca-api-source/* monasca-api \
    && {{ macros.install_pip(monasca_api_pip_packages | customizable("pip_packages")) }}

{% endif %}

COPY extend_start.sh /usr/local/bin/kolla_monasca_extend_start
RUN chmod 755 /usr/local/bin/kolla_monasca_extend_start

{% block monasca_api_footer %}{% endblock %}

{% block footer %}{% endblock %}
